﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HKEA.CMS.Core.BLL;
using HKEA.CMS.Core.Models;
using HKEA.CMS.Core.Utility;
using System.Data.Common;
using System.Data.Common.EntitySql;
using System.Data.Linq.SqlClient;
using System.Data.Objects;
using System.Data.Linq;
using HKEA.CMS.Core.BLL.Tbl;
namespace WebApplication
{
    public partial class ContactPersonList : BasePage
    {
        tblCustomer customerENT = new tblCustomer();
        tblCustomerBLL customerBLL = new tblCustomerBLL();
        protected int uid = 0;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (int.TryParse(Request.QueryString["uid"], out uid))
                {
                    hdCustomerUID.Value = uid.ToString();
                    if (Request.QueryString["cid"] != null)
                    {
                        hdCPUID.Value = Request.QueryString["cid"].ToString();
                    }
                }
            }
        }
        #region 按钮事件
        protected void UpdateCP()
        {
            if (uid > 0)
            {
                int cpuid = 0;
                if (int.TryParse(Request.QueryString["cpuid"], out cpuid))
                {

                }
                tblCust_ContactPerson cust_cp = new tblCust_ContactPerson();
                tblCust_ContactPersonBLL cust_cpBLL=new tblCust_ContactPersonBLL();
                cust_cp.CustomerUID = uid;
                cust_cp.ContactPersonUID = cpuid;
                cust_cp.Deleted = 0;
                cust_cp = cust_cpBLL.GetEntity(cust_cp);
                if (cust_cp != null)
                {
                }
            }
        }
        #endregion

        #region 页面初始化事件

        protected void BindCPList(int uid)
        {
            tblCust_ContactPerson cust_CPENT = new tblCust_ContactPerson();
            tblCust_ContactPersonBLL cust_CPBLL = new tblCust_ContactPersonBLL();
            cust_CPENT.CustomerUID = 8;
            var list = cust_CPBLL.GetCPListDetail(uid);
            if (list.Count > 0)
            {
                rptCPList.DataSource = list;
                rptCPList.DataBind();
            }
        }

        #endregion
        
    }
}